package com.tiantang.cp.api.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.tiantang.cp.api.bean.Pager;
import com.tiantang.cp.api.bean.TbComicChapter;
import com.tiantang.cp.api.bean.TbComicFile;
import com.tiantang.cp.api.bean.TbComicInfo;
import com.tiantang.cp.api.service.ComicService;

@RestController
public class ComicController {

	@Autowired
	private ComicService comicService;
	
	/**
	 * 漫画列表
	 * @param token
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(value="/comic/list/{pageNo}",method = RequestMethod.GET)
	public List<TbComicInfo> category(@PathVariable("pageNo") int  pageNo) throws Exception{
		Pager pager = new Pager();
		pager.setPageNo(pageNo);
		return comicService.getComicList(pager);
	}
	
	@RequestMapping(value="/comic/getChapters/{comicId}",method = RequestMethod.GET)
	public List<TbComicChapter> getChapters(@PathVariable("comicId") Long  comicId) throws Exception{
		return comicService.getChapters(comicId);
	}
	
	
	@RequestMapping(value="/comic/getChapterFiles/{chapterId}",method = RequestMethod.GET)
	public List<TbComicFile> getChapterFiles(@PathVariable("chapterId") Long  chapterId) throws Exception{
		return comicService.getComicFiles(chapterId);
	}
	
}
